require("dotenv").config();
const { ethers } = require("hardhat");

async function main() {
  // 检查环境变量
  if (!process.env.PRIVATE_KEY) {
    throw new Error("请在.env文件中设置PRIVATE_KEY");
  }
  if (!process.env.ALCHEMY_API_KEY) {
    throw new Error("请在.env文件中设置ALCHEMY_API_KEY");
  }

  // hardhat配置的账户
  const [deployer] = await ethers.getSigners();
  console.log("Hardhat部署账户:", deployer.address);

  // 检查余额
  const balance = await ethers.provider.getBalance(wallet.address);
  console.log("余额:", ethers.formatEther(balance), "ETH");
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});